import { createRouter, createWebHistory} from 'vue-router';

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      redirect:'/home'
    },
    {
      name: 'home',
      path: '/home',
      component: () => import('@/pages/home/index.vue'),
    },
    {
      name: 'list',
      path: '/list',
      component: () => import('@/pages/home/List/List.vue')
    },
    {
      name:'category',
      path: '/category',
      component: () => import('@/pages/category/index.vue'),
    },
    {
      name: 'catelist',
      path: '/catelist/:categoryType/:subCategoryId/:categoryId',
      component: () => import('@/pages/catelist/index.vue'),
    },
    {
      name: 'worthbuying',
      path: '/worthbuying',
      component: () => import('@/pages/worthBuying/index.vue'),
    },
    {
      name: 'personal',
      path: '/personal',
      component: () => import('@/pages/personal/index.vue'),
    },
    {
      name:'goodsdetail',
      path: '/goodsdetail/:id',
      component: () => import('@/pages/goodsDetail/index.vue'),
    },
    {
      name:'search',
      path: '/search',
      component: () => import('@/pages/search/index.vue'),
    },
    {
      name:'cart',
      path: '/cart',
      component: () => import('@/pages/cart/index.vue'),
    },

    {
      name:'searchInside',
      path: '/searchInside',
      component: () => import('@/pages/searchInside/index.vue'),
    },
    {
      name: 'login',
      path: '/login',
      component: () => import('@/pages/login/login.vue'),
      meta: {
        hidden: false
    }
    },
   
    {
      path: '/register',
      component: () => import('@/pages/personal/register/register.vue'),
      meta: {
          hidden: true
      }
    },
    {
      name: 'address',
      path: '/address',
      component: () => import('@/pages/address/index.vue'),
    },
    {
      name: 'addaddress',
      path: '/addaddress',
      component: () => import('@/pages/address/addAddress.vue'),
    },
    {
      name: 'error',
      path: '/error',
      component: () => import('@/pages/error/404.vue'),
    }


  ],
  scrollBehavior() {
    return { top: 0, left: 0 }
  },
})

// 导出路由
export default router;